November 1995

Ftptool gives you more power for file transfers

A great deal of useful information is stored on computer systems throughout the world. Many of these files are freely available to you as a member of the Internet. A simple method for transferring such files from a remote computer to your computer is anonymous ftp (file transfer protocol). Typically, an ftp session takes place using a command-line ftp program such as Solaris 2.x ftp.

If you perform file transfers with the Solaris 2.x ftp utility, then you probably know what a time-consuming task transferring data can be. The Solaris 2.x ftp utility works well, but wouldn't it be nice not to have to remember all the commands to get the job done? Ftptool, a free ftp utility available on the Internet from Sun Microsystems, lets you utilize an easy-to-use graphical user interface for ftp sessions. If you use OpenWindows or the Common Desktop Environment for Solaris, you'll want to get a copy of the Ftptool utility.

In this article, we'll take a look at the free ftp utility, Ftptool, from Sun Microsystems. We'll show you how to use the utility to transport files as well as prepare files for transfer. We'll also show you where to get Ftptool and how to download it with Solaris' ftp command-line utility.

Getting started

Before we look at Ftptool, you'll need to know where you can find the utility on the Internet. Sun Microsystems supports several anonymous ftp archives, called SunSITEs, where you can find Ftptool. One of the largest SunSITE archives is at the University of North Carolina. Using Solaris' ftp command-line utility, you can access the UNC SunSITE and download the program files.

To begin your ftp session, enter the command

#ftp sunsite.unc.edu

at a command prompt. When you make the connection, you'll see the message

Connected to sunsite.unc.edu

You'll then be prompted to enter your user name. Since this is an anonymous ftp archive, enter anonymous as your user name. When prompted for your password, enter your E-mail address. As with most passwords, the characters will not echo to the screen as you type. Once you've successfully logged on, you'll see the welcome message shown in Figure A.

Now that you're connected, you'll need to find the Ftptool utility. Using the command

ftp>cd /pub/X11/Openlook/ftptool

change to the directory where the Ftptool files are located. Enter the command dir to view a list of the files located in this directory. Of the files listed, you'll want to download the filename

Ftptool4.3.sun.1.tar.Z

for Solaris 2.x on the SPARC platform. This is the compiled binary version of the Ftptool utility. The other files listed contain the Ftptool utility, but they're not compiled. If you want to use Ftptool on a Solaris x86 system, you'll need to download the file

Ftptool4.3.unc.1.tar.Z

and compile the program with your C compiler.

Before you begin your download, make sure to change ftp to binary mode for the file transfer. Enter the command

ftp>bin

to change to binary mode. Once you've set ftp to binary transfer mode, you're ready to download Ftptool. Enter the command

ftp>get Ftptool4.3.sun.1.tar.Z

to begin downloading the file. When the transfer is finished, you should see the message

Transfer complete

You can then end your ftp session. Make sure to enter the command disconnect before exiting ftp.

Now that you have the file, you'll want to move it to an appropriate directory before you uncompress it. Once uncompressed, use the command

ftp xvf Ftptool.4.3.sun.1.tar

to extract the Ftptool binary files into an Ftptool4.3.bin directory.

Configuring Ftptool properties

After you've uncompressed and extracted Ftptool, you can launch the utility in OpenWindows or the Common Desktop Environment. The executable file ftptool launches the graphical user interface shown in Figure B. Once you've opened Ftptool, you'll want to customize its properties for your system.

To customize Ftptool for your system, pull down the Properties menu and select Tool…. This opens the Ftptool: Properties window shown in Figure C. Within the Properties window, you can configure Ftptool's default settings for your ftp sessions. The possibilities include:

Once you've configured Ftptool, click the Apply button at the bottom of the Properties window. You'll then see a prompt for saving the changes you've made permanently or just for this Ftptool session. Select the appropriate button for saving your changes. Now, let's look at how to use Ftptool.

TABLE A

Variable/Meaning

PERMS

Normal UNIX parameters (drwxrwxrwx)

LINKS

Link count--currently matched, but discarded

USER

User name/number

GROUP

Group name/number

SIZE

File size

MONTH

Month (Jan, Feb, Mar, etc.)

DAY

Day of week (1, 2, 3, etc.)

TIME

Hour:minute (09:45)

NAME

Filename

SKIP

Discard characters until the next white space

NONUNIX

Special Case--its appearance in the string sets non-UNIX mode.

LOWERNAMES

Special Case--it causes all filenames that are read from remote to be converted to lower case.

Using Ftptool

To initiate an ftp session with Ftptool, press the Connect button in the main Ftptool window. This will open the Host Information window, which contains the remote host address as well as your user name (anonymous) and password. To view additional information about a remote host, press the Additional Parameters… button in the Host Information window. This will expand the window as shown in Figure D.

In the Additional Parameters area, you can configure several settings to use when connecting to a given host. The top line lets you give a host an alias, which will appear on your Hot List in the Host Information main window. Below the Alias: line, the Last Visited: line shows you when you last connected to an ftp site. In the Comment: field, you can enter any information pertinent to an ftp site for your own reference.

The bottom four selections in the Additional Parameters area enable some very convenient features. In the Transfer mode: area, you can select the default transfer mode--Binary, ASCII, or Tenex--when you connect to a given host. This enables you to tell Ftptool how you want to transfer files before you connect to the host.

The next field, Remote CD to:, lets you specify a change directory (cd) command, which will automatically execute when you connect to an ftp site. If you do a high volume of file transfers via ftp, you can specify the directory on an anonymous ftp server to change to when you connect to the server.

The Local CD to: field lets you specify a change directory command for your local system when you connect to a given host. Enter the path for the directory where you want your ftp transfers stored on your local system. If you leave this field blank, the default remote directory is the configured ftp root. The default local directory is the one where your Ftptool executable file is located.

The last field in the Additional Parameters area for the Host Information window is the DIR Template:. In this field, you can configure your directory view for looking at both local and remote files with Ftptool. You should separate each setting in this field by a single space. See the variables listed in Table A for valid input in this field.

Connecting to a host

Once you've configured your host settings, you're ready to use Ftptool to connect to a host. Press the Connect to Host button in the Host Information main window to connect to the UNC SunSITE, shown in Figure D. Once connected, you'll see a file listing in the Ftptool main window, as shown in Figure E. You'll also see the address of the ftp host in the title bar.

After connecting to an ftp host, you can change directories on the remote system by simply double-clicking the directory you want to access. You can also use this point-and-click method to access files and directories on your local system.

To view your default local directory for file transfers, pull down the View menu in Ftptool's main window and select Local Directory List…. This will open the default local directory for the ftp host that you configured in the Host Information: Additional Parameters window. The window will also display the local host name in the title bar, as shown in Figure F. In this way, you can keep track of which window is currently displaying a file list for a given remote host or local system.

Transferring files

Transferring files with Ftptool is as easy as viewing them. To select a file for transfer from the remote host to the local system or vice versa, click the file once to highlight it, as shown in Figure G. Once the file is highlighted, you can select other files in the same directory for a batch transfer. You can also select directories for transfer with Ftptool, which you can't do with Solaris' ftp utility.

Once you've highlighted a file, pull down the File menu and select Copy. Then select the appropriate menu item, either Remote to Local or Local to Remote. When you've made your selection, the ftp transfer will begin and you'll see the Transfer Status window, as shown in Figure H. When your transfer completes, the Transfer Status window will close and the status message "Receive of filename complete" will appear in the lower-left corner of the Ftptool main window.

Creating directories, deleting files, and creating archives online

In addition to making your ftp sessions easier, Ftptool can help you manage your ftp archives for your enterprise. With the proper user permissions, you can create directories, delete files, and create archives for transfer, all while connected to an ftp host. First, let's take a look at creating directories with Ftptool.

Creating a directory on a remote or local system with Ftptool is simple enough when you have the correct user permission level. By configuring your login for ftp to a remote host as we've demonstrated, you can log into the remote host as any user, including the superuser root. Enter the path of the directory you want to create in the Remote Directory or Local Directory field in the main window of Ftptool. If the directory doesn't exist, you'll see a prompt to try to create the directory or cancel the command, as shown in Figure I.

Deleting files is just as easy as creating directories when you have the right permission level. Simply select a file with your mouse cursor, as if you were marking the file for transfer. Pull down the File menu and select the Delete menu item. Then choose which file you want to delete, either Remote or Local, as shown in Figure J. You'll then confirm the file deletion by pressing the Delete button in the prompt provided. You can also perform this operation for more than one file at a time.

Creating an archive while you're online with an ftp host lets you perform actions you'd normally have to do prior to logging on to a host. For example, let's say you have several text and postscript files you'd like to archive and compress before you transfer them from your local system to an ftp host. Open the Local Directory List from the View menu in the main window of Ftptool.

Once the Local Host window opens, select the files on the local host you want to archive as you normally would for file transfers. Once you've selected the files, pull down the File menu in the Ftptool main window and select Create Tar File. Then you'll need to enter the new filename in the dialog box provided, as shown in Figure K.

In addition to archiving, you can compress files with Ftptool. This helps decrease the size of your files for transfer. You can also execute the opposite commands of uncompressing or extracting files. We recommend that you uncompress or extract files only on your local system, however, since cleaning up any mistakes is much easier from your local system.

Batch scheduling

If you find that you simply don't have time to transfer files during normal business hours, you can schedule your file transfers during off hours by using the Ftptool Batch Scheduling feature. First, use your mouse to select the files as you normally would for a file transfer. Then from the Ftptool main window, pull down the View menu and select Batch Schedule…. This will open the Batch Schedule window.

Now the steps become a little tricky. Move your cursor to the Local Directory List or the Remote Directory List where you've selected your files. Click the right mouse button to open a pop-up menu and then select Add to Batch Send or Receive List, depending upon which type of transfer you want to complete. For example, if you wanted to send the files shown in Figure K to our Inside Solaris anonymous ftp archive, you'd select the files and choose Add to Batch Send List from the pop-up menu. The files would then appear in the Schedule Batch Transfer window, as shown in Figure L.

You can select your hosts for transfer from the Host List menu in the Schedule Batch Transfer window. Once the correct host appears in the Target field, set the date and time for the transfer and press the Process Batch button. Ftptool must continue to run until the scheduled time expires and the transfer completes. At any time, you can abort the batch by pressing the Abort Batch button after processing a given batch.

Conclusion

Command-line utilities like Solaris' ftp are essentially the bare minimum needed for interaction between a host and local systems. If you'd like a more powerful tool to complete your file transfer tasks with fewer keystrokes and an easy-to-use interface, you should give Ftptool a try. In addition to its availability on the UNC SunSITE ftp archive, Ftptool is available for downloading from the Inside Solaris anonymous ftp archive. In this article, we've demonstrated some of the techniques for using Ftptool.


[Return to Index for Inside Solaris - November Issue]

Copyright (c) 1995 The Cobb Group, a division of Ziff-Davis Publishing Company. All rights reserved.

Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis

Publishing Company is prohibited. The Cobb Group and The Cobb Group logo are trademarks of

Ziff-Davis Publishing Company.

Inside Solaris is a publication of The Cobb Group.
1-800-223-8720